<?php

namespace app\common\model;

use think\Model;
use think\Db;
/**
 * 公司
 */
class Company Extends Model
{

    /**
     * 解散团队
     */
    public static function dismiss($user_id,$company_id){
        $companyM = new \app\admin\model\Company();
        $company = $companyM->get($company_id);
        $company->delete();
        $user = \app\common\model\User::get($user_id);
        $user->company_id = 0;
        $user->selfcompany_id = 0;
        $user->save();
        Db::name('user')->where(['company_id' => $company_id])->update(['company_id' => 0,'is_access' => 1]);

    }


}